<template>
  <div class="user">
    <basic-container>
      <avue-form ref="form" v-model="form" :option="formOption" @submit="handleSubmit"></avue-form>
    </basic-container>
  </div>
</template>

<script>
import { mapGetters } from "vuex";

import { addText, getText } from "@/api/admin/set";


export default {
  data() {
    return {
      formOption: {
        submitText: "完成",
        menuBtn: true,
        column: [
          {
            label: "内容",
            component: "avueUeditor",
            params:{
              options: {
                props: {
                  res: "data",
                  url: "url"
                },
                customConfig: {
                  menus: [
                  'head',
                  'bold',
                  'fontSize',
                  'fontName',
                  'italic',
                  'underline',
                  'strikeThrough',
                  'indent',
                  'lineHeight',
                  'foreColor',
                  'backColor',
                  'justify',
                  'image',
                  'splitLine'
                  ]
                },
                oss: 'qiniu',
                qiniu: {
                  deadline: 1,
                  AK: 'N5JlC7j47V83d0uuJCEeWOMyjvMuZGvxwmONtPjt',//七牛云相关密钥
                  SK: '79bOMGWIy_xm9lk6dPIwxySbH1r9mk3GnSpgRGdb',//七牛云相关密钥
                  scope: 'yumiapp',//存储空间名称
                  url: 'http://imgyumi.keji.cn/'//外链的域名地址
                }
              },
            },
            rules: [
              {
                required: true,
                message: "请输入"
              }
            ],
            span: 24,
            prop: "content"
          }
        ]
      },
      form: {},
      showResult: false,
    };
  },
  computed: {
    ...mapGetters(["permissions", "access_token"])
  },
  created() {
    this.getContnet()
  },
  methods: {
    getContnet(){
      getText(12).then(res=>{
        this.form = res.data.data
      })
    },
    handleSubmit(form,done){
      addText(Object.assign({id: 12}, this.form)).then(response => {
        this.$message.success('修改成功');
        done()
      });
    }
  }
};
</script>
